package com.ruoyi.system.service.impl;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserWithdrawLogMapper;
import com.ruoyi.system.domain.UserWithdrawLog;
import com.ruoyi.system.service.IUserWithdrawLogService;
import com.ruoyi.common.support.Convert;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户提现记录 服务层实现
 * 
 * @author ruoyi
 * @date 2019-06-21
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserWithdrawLogServiceImpl implements IUserWithdrawLogService 
{
	@Autowired
	private UserWithdrawLogMapper userWithdrawLogMapper;

	/**
     * 查询用户提现记录信息
     * 
     * @param id 用户提现记录ID
     * @return 用户提现记录信息
     */
    @Override
	public UserWithdrawLog selectUserWithdrawLogById(Integer id)
	{
	    return userWithdrawLogMapper.selectUserWithdrawLogById(id);
	}
	
	/**
     * 查询用户提现记录列表
     * 
     * @param userWithdrawLog 用户提现记录信息
     * @return 用户提现记录集合
     */
	@Override
	public List<UserWithdrawLog> selectUserWithdrawLogList(UserWithdrawLog userWithdrawLog)
	{
	    return userWithdrawLogMapper.selectUserWithdrawLogList(userWithdrawLog);
	}
	
    /**
     * 新增用户提现记录
     * 
     * @param userWithdrawLog 用户提现记录信息
     * @return 结果
     */
	@Override
	public int insertUserWithdrawLog(UserWithdrawLog userWithdrawLog)
	{
	    return userWithdrawLogMapper.insertUserWithdrawLog(userWithdrawLog);
	}
	
	/**
     * 修改用户提现记录
     * 
     * @param userWithdrawLog 用户提现记录信息
     * @return 结果
     */
	@Override
	public int updateUserWithdrawLog(UserWithdrawLog userWithdrawLog)
	{
	    return userWithdrawLogMapper.updateUserWithdrawLog(userWithdrawLog);
	}

	/**
     * 删除用户提现记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteUserWithdrawLogByIds(String ids)
	{
		return userWithdrawLogMapper.deleteUserWithdrawLogByIds(Convert.toStrArray(ids));
	}

	/**
	 * 设置为已发货
	 *
	 * @param id
	 * @return
	 */
	@Override
	public int updateTransferedById(int id) {
		Timestamp timestamp = Timestamp.valueOf(LocalDateTime.now());

		return userWithdrawLogMapper.updateTransferedById(id,timestamp);
	}

}
